package com.lv.LvPriceComboOfTourismModel.service;
import com.aqgj.User.bean.User;
import com.lv.LvPriceComboOfTourismModel.bean.LvPriceComboOfTourismModel;
import com.lv.LvPriceComboOfTourismModel.dao.LvPriceComboOfTourismModelDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service("LvPriceComboOfTourismModel")
public class LvPriceComboOfTourismModelManager{
    @Autowired
    LvPriceComboOfTourismModelDao lvPriceComboOfTourismModelDao;

    /**
     * 保存旅游模板价格套餐
     * @param lvPriceComboOfTourismModel 旅游模板几个套餐对象
     * @param lvTourismModelId 旅游模板id
     * @param user 用户对象
     * @return
     */
    public String save(LvPriceComboOfTourismModel lvPriceComboOfTourismModel, String lvTourismModelId, User user) {
        Date now=new Date();
        lvPriceComboOfTourismModel.setFkTourismModelId(lvTourismModelId);
        lvPriceComboOfTourismModel.setAddTime(now);
        lvPriceComboOfTourismModel.setFkAddUserId(user.getId());
        lvPriceComboOfTourismModel.setStatus(0);
        lvPriceComboOfTourismModelDao.save(lvPriceComboOfTourismModel);
        return "1";
    }

    /**
     * 修改旅游模板价格套餐
     * @param lvPriceComboOfTourismModel 旅游模板价格套餐对象
     * @param user 用户对象
     * @return
     */
    public String update(LvPriceComboOfTourismModel lvPriceComboOfTourismModel, User user) {
        Date now=new Date();
        lvPriceComboOfTourismModel.setModifyTime(now);
        lvPriceComboOfTourismModel.setFkModifyUserId(user.getId());
        return  lvPriceComboOfTourismModelDao.update(lvPriceComboOfTourismModel);
    }

    /**
     * 删除
     * @param id 旅游模板价格套餐id
     * @return
     */
    public String delete(String id) {
        lvPriceComboOfTourismModelDao.removeById(id);
        return "1";
    }
}
